package com.bhs.sansong.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansong.R;
import com.bhs.sansong.bean.AddressInfo;
import com.bhs.sansong.bean.AddressList;
import com.bhs.sansong.utils.MyUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * 地址薄
 */
public class AddressBookAdapter extends BaseQuickAdapter<AddressInfo, BaseViewHolder> {

    public AddressBookAdapter() {
        super(R.layout.item_address_book);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, AddressInfo item) {
        helper.setText(R.id.tv_company_name, item.getRemark());
        helper.setText(R.id.tv_user_info, String.format("%s %s", item.getTruename(), MyUtils.phoneHide(item.getMobile())));
        helper.setText(R.id.tv_name, item.getCity() + item.getCounty() + item.getAddress());
        helper.setChecked(R.id.cb_default, item.getIs_default() == 1);
        helper.addOnClickListener(R.id.cb_default, R.id.tv_edit, R.id.tv_delete);
    }
}
